package com.itheima.eurekaprovider.controller;

import org.springframework.web.bind.annotation.*;
import com.itheima.eurekaprovider.entity.User;

@RestController
public class HelloController{
    @RequestMapping(value="/hello",method = RequestMethod.GET)
    public String hello() {
        return "Hello World！";
    }

    @RequestMapping(value = "/hello1",method = RequestMethod.GET)
    public String hello(@RequestParam String name){
        return "Hello "+name;
    }

    @RequestMapping(value = "/hello2",method = RequestMethod.GET)
    public User hello(@RequestParam String name, @RequestHeader Integer age){
        return new User(name,age);
    }
    @RequestMapping(value = "/hello3",method = RequestMethod.POST)
    public String hello(@RequestBody User user){
        return "Hello "+user.getName()+","+user.getAge();
    }

    //课堂任务 添加 /hello4 请求处理方法,POST方式，接收 name,age 参数，并 输出 hello name , age
}
